package edu.nus.mtech.sem1.ca.plan.valueadd;

import java.io.Serializable;
import java.util.Date;

import edu.nus.mtech.sem1.ca.cust.Status;
import edu.nus.mtech.sem1.ca.utils.TelephonyUtils;


/**
 * This is the top level abstraction of all ValueAddedService
 *
 */
public class ValueAddedService implements Serializable{
	
	private String valueAddedId;
	private ValueAddedType valueAddedType; //this should be gone, hopefully
	private String description ;//Just not going to use this field at all.
	
	private Date dateCommenced;
	private Date dateTerminated;
	private String telephoneNumber;
	private Status subscriptionStatus;
	private String additionalChannels;
	
	protected void getCharge(){}


	public ValueAddedType getValueAddedType() {
		return valueAddedType;
	}


	public void setValueAddedType(ValueAddedType valueAddedType) {
		this.valueAddedType = valueAddedType;
	}


	public String getDescription() {
		return description;
	}


	public void setDescription(String description) {
		this.description = description;
	}
	

	@Override
	public boolean equals(Object valueAddedServiceObj) {
		boolean allResult=false;
		
		if (valueAddedServiceObj!=null && valueAddedServiceObj instanceof ValueAddedService){
			ValueAddedService incomingValueAddedService=(ValueAddedService)valueAddedServiceObj;
			
			if (incomingValueAddedService.getValueAddedId().equals(valueAddedId)){
				allResult=true;
			}
		}
		return allResult;
	}
	
	@Override
	public int hashCode() {
		
		//Had to override the hashcode method because we have overridden the equals method.
		// Just multiplying with a good primary number to avoid false duplicates
		int hashCode=(TelephonyUtils.getHashCode(valueAddedId)*73)+TelephonyUtils.getHashCode(valueAddedType)+TelephonyUtils.getHashCode(dateCommenced)+TelephonyUtils.getHashCode(dateTerminated)+TelephonyUtils.getHashCode(telephoneNumber)+TelephonyUtils.getHashCode(subscriptionStatus);
		return hashCode;
		
	}

	@Override
	public String toString() {
		return(valueAddedId+"::"+valueAddedType+"::"+dateCommenced+"::"+dateTerminated+"::"+telephoneNumber+"::"+additionalChannels+"::"+subscriptionStatus);
	}


	public Date getDateCommenced() {
		return dateCommenced;
	}


	public void setDateCommenced(Date dateCommenced) {
		this.dateCommenced = dateCommenced;
	}


	public Date getDateTerminated() {		
		return dateTerminated;
	}


	public void setDateTerminated(Date dateTerminated) {
		this.dateTerminated = dateTerminated;
	}


	public String getTelephoneNumber() {
		return telephoneNumber;
	}


	public void setTelephoneNumber(String telephoneNumber) {
		this.telephoneNumber = telephoneNumber;
	}


	public Status getSubscriptionStatus() {
		return subscriptionStatus;
	}


	public void setSubscriptionStatus(Status subscriptionStatus) {
		this.subscriptionStatus = subscriptionStatus;
	}


	public String getValueAddedId() {
		return valueAddedId;
	}


	public void setValueAddedId(String valueAddedId) {
		this.valueAddedId = valueAddedId;
	}


	public String getAdditionalChannels() {
		return additionalChannels;
	}


	public void setAdditionalChannels(String additionalChannels) {
		this.additionalChannels = additionalChannels;
	}
}
